<?php
    include_once('connect.php');
    $product_id = $_POST['product_id'];
    $db = new database("SELECT img_name
                        FROM images_product
                        WHERE pro_id = ".$product_id);
    $arr_img['img_name'] = $db->render(); 
    $arr_img['number_record'] = $db->num_row();

    $arr_img_pro = array();
    $i=1;
    while($i < $arr_img['number_record']){
        $arr_img_pro['img_name'][$i] = $arr_img['img_name'][$i]['img_name'] ;    
        $i++;
    }
    $arr_img_pro['number_record'] = $arr_img['number_record'];
    echo json_encode($arr_img_pro);


?>